package galaxies;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/*
 * Holds all custom galaxy data loaded from XML files
 */
public class CustomGalaxyList {
	
	private HashMap<String, CustomGalaxyData> galaxyData = new HashMap<String, CustomGalaxyData>();
	private ArrayList<String> entries = new ArrayList<String>();
	
	public ArrayList<String> getEntries() {
		return this.entries;
	}
	
	public void addData(String ref, CustomGalaxyData data) {
		galaxyData.put(ref, data);
		entries.add(ref);
	}
	
	public CustomGalaxyData getData(String ref) {
		return galaxyData.get(ref);
	}
	
	public HashMap<String, CustomGalaxyData> getAllGalaxyData() {
		return this.galaxyData;
	}
	
	public void setGalaxyData(HashMap<String, CustomGalaxyData> data) {
		this.galaxyData.clear();
		this.galaxyData.putAll(data);
		
		entries.clear();		
		for (Map.Entry<String, CustomGalaxyData> entry : data.entrySet()) {
			entries.add(entry.getKey());
		}
	}

}
